from threading import Thread
import time


def test1(args):
    args.append(33)
    print("-----in test1 g_nums=%s" % str(args))


def test2(args):
    print("-----in test2 g_nums=%s" % str(args))


g_nums = [11, 22]


def main():
    # target 参数指定要执行的代码
    # args 参数指定将来调用的函数需要的参数，参数为元组类型
    t1 = Thread(target=test1, args=(g_nums,))
    t2 = Thread(target=test2, args=(g_nums,))

    t1.start()
    time.sleep(1)

    t2.start()
    time.sleep(1)

    print("-----in main g_nums=%s" % str(g_nums))

if __name__ == "__main__":
    main()